#ifndef HITABLECUH
#define HITABLECUH

#include "aabb.cuh"
#define __duel__ __host__ __device__
class material;
struct hit_record
{
    float t;
    //对应纹理的uv
    float u;
    float v;
    vec3 p;
    vec3 normal;
    material *mat_ptr;
    bool front_face;
    __device__ inline void set_face_normal(const ray& r, const vec3& outward_normal) \
    {
        front_face = dot(r.direction(), outward_normal) < 0;
        normal = front_face ? outward_normal :-outward_normal;
    }
};

class hitable  {
    public:
        __device__ virtual bool hit(const ray& r, float t_min, float t_max, hit_record& rec) const = 0;
        __duel__ virtual bool bounding_box(float t0, float t1, aabb& output_box) const = 0;
        __duel__ virtual ~hitable(){};
};

#endif
